// 请详细阅读本页的注释 @作者林金滨
import { createRouter, createWebHistory ,createWebHashHistory} from 'vue-router'

// 这边引入你要显示出来的组件
import Index from '../views/index/index.vue'
import Login from '../views/login/index.vue'
import UploadImageVue from '../views/admin/images/upload/index.vue'
import Layout from '../views/index.vue'
// 列表页
import List from '../views/admin/List/index.vue'
import Upload from '../views/admin/images/Upload/index.vue'
import Category from '../views/admin/Category/index.vue'
import Tag from '../views/admin/Tag/index.vue'
import Recycle from '../views/admin/Recycle/index.vue'
import ImagesLayout from '../views/admin/images/index.vue'
// 图片管理模块
import EditImage from '../views/admin/images//Edit/index.vue'
import BatchOperation from '../views/admin/images/BatchOperation/index.vue'
import ImageSearch from '../views/admin/images/search/index.vue'
import ShareImage from '../views/admin/images/share/index.vue'
import Watermark from '../views/admin/images/watermark/index.vue'
import ImageCompress from '../views/admin/images/compress/index.vue'
import ImageVersions from '../views/admin/images/versions/index.vue'
import ImagePermission from '../views/admin/images/permission/index.vue'
import ImageFavorites from '../views/admin/images/favorites/index.vue'
import ImageComments from '../views/admin/images/comments/index.vue'
import ImageImportExport from '../views/admin/images/importExport/index.vue'
import ImageReview from '../views/admin/images/review/index.vue'
import TagSuggestions from '../views/admin/images/tagSuggestions/index.vue'
import ImageHistory from '../views/admin/images/history/index.vue'
// 统计模块
import ImageStatistics from '../views/admin/statistics/index.vue'

const router = createRouter({
  // 全部路由都在这里
  history: createWebHashHistory(),

  // 路由的配置
  // 本项目分为3个大路由
  routes: [
    // 主页路由
    {
      // 地址
      path: "/index",
      // 对应的组件
      component: Index
    },

    
    // 登录路由
    {
      // 地址
      path: "/login",
      // 对应的组件
      component: Login
    },

    {
        path:'/',
        component:Layout,
        children:[{
          // 本段的是管理的路由页面admin为根目录
          // 本页配置的路由是为了后续方便添加所设置
          // 一个路由必需包含path, component, meta, 孩子路由是可以不存在的.本人无法保证bug,请不要更改
          path: 'admin', // 根目录
          meta: { id: '1', name: '管理模块', icon: 'Setting', describe: '系统管理和配置' },
          children: [
            // 图片管理模块
              {
            path: 'images',
            meta: { id: '1', name: '图片管理', icon: 'Picture', describe: '图片资源的上传、管理和统计分析' },
            children: [
                {
                  path: 'upload',
                  component: UploadImageVue,
                  meta: { id: '1', name: '图片上传', icon: 'Upload', describe: '上传单张或批量上传图片', path: '/admin/images/upload' },
                },
                {
                  path: 'edit', // 通过图片 ID 编辑
                  component: EditImage,
                  meta: { id: '2', name: '图片编辑', icon: 'Edit', describe: '编辑已上传的图片', path: '/admin/images/edit' },
                },
                {
                  path: 'batch',
                  component: BatchOperation,
                  meta: { id: '3', name: '批量操作', icon: 'Operation', describe: '批量管理图片', path: '/admin/images/batch' },
                },
                {
                  path: 'search',
                  component: ImageSearch,
                  meta: { id: '4', name: '图片搜索', icon: 'Search', describe: '通过条件搜索图片', path: '/admin/images/search' },
                },
                {
                  path: 'share', // 通过图片 ID 分享
                  component: ShareImage,
                  meta: { id: '5', name: '图片分享', icon: 'Share', describe: '生成图片分享链接', path: '/admin/images/share' },
                },
                {
                  path: 'watermark',
                  component: Watermark,
                  meta: { id: '6', name: '图片水印', icon: 'Box', describe: '为图片添加水印', path: '/admin/images/watermark' },
                },
                {
                  path: 'compress',
                  component: ImageCompress,
                  meta: { id: '7', name: '图片压缩', icon: 'MessageBox', describe: '压缩图片以减少存储空间', path: '/admin/images/compress' },
                },
                {
                  path: 'versions', // 通过图片 ID 查看版本
                  component: ImageVersions,
                  meta: { id: '8', name: '版本管理', icon: 'Files', describe: '管理图片的历史版本', path: '/admin/images/versions' },
                },
                {
                  path: 'permission', // 通过图片 ID 设置权限
                  component: ImagePermission,
                  meta: { id: '9', name: '权限管理', icon: 'Lock', describe: '设置图片的访问权限', path: '/admin/images/permission' },
                },
                {
                  path: 'favorites',
                  component: ImageFavorites,
                  meta: { id: '10', name: '我的收藏', icon: 'Star', describe: '查看和管理收藏的图片', path: '/admin/images/favorites' },
                },
                {
                  path: 'comments', // 通过图片 ID 查看评论
                  component: ImageComments,
                  meta: { id: '11', name: '图片评论', icon: 'ChatDotRound', describe: '查看和管理图片评论', path: '/admin/images/comments' },
                },
                {
                  path: 'importExport',
                  component: ImageImportExport,
                  meta: { id: '12', name: '导入/导出', icon: 'UploadFilled', describe: '导入或导出图片', path: '/admin/images/importExport' },
                },
                {
                  path: 'review',
                  component: ImageReview,
                  meta: { id: '13', name: '图片审核', icon: 'Checked', describe: '审核用户上传的图片', path: '/admin/images/review' },
                },
                {
                  path: 'tagSuggestions',
                  component: TagSuggestions,
                  meta: { id: '14', name: '标签推荐', icon: 'MagicStick', describe: '基于图片内容推荐标签', path: '/admin/images/tagSuggestions' },
                },
                {
                  path: 'history', // 通过图片 ID 查看历史
                  component: ImageHistory,
                  meta: { id: '15', name: '操作历史', icon: 'Clock', describe: '查看图片的操作历史记录', path: '/admin/images/history' },
                },
              ],
            },
            // 分类管理模块
            {
              path: 'category',
              component: Category,
              meta: { id: '2', name: '分类管理', icon: 'Collection', describe: '管理图片分类和目录结构', path: '/admin/category' },
            },

            // 标签管理模块
            {
              path: 'tag',
              component: Tag,
              meta: { id: '3', name: '标签管理', icon: 'PriceTag', describe: '管理图片标签系统', path: '/admin/tag' },
            },
            // 回收站模块
            {
              path: 'recycle',
              component: Recycle,
              meta: { id: '4', name: '回收站', icon: 'Delete', describe: '已删除图片的恢复和管理', path: '/admin/recycle' },
            },
            // 统计模块
            {
              path: 'statistics',
              component: ImageStatistics,
              meta: { id: '5', name: '图片统计', icon: 'DataAnalysis', describe: '查看图片的访问和下载统计', path: '/admin/statistics' },
            },
          ],
        },
      ]
    }
      ],
})

// 暴露路由
export default router